import Vue from 'vue'
import Toaster from './Toaster.vue'

let ToasterComponent = Vue.extend(Toaster)

export default {
  Toast (message, type, fixed = false, autoCloseTime = 2000) {
    let vm = new ToasterComponent()
    vm.message = message
    vm.type = type
    vm.fixed = fixed
    vm.autoCloseTime = autoCloseTime
    vm.$mount()
    document.body.appendChild(vm.$el)
    vm.show()
    return vm
  },
  SUCCESS: 'success',
  INFO: 'info',
  ERROR: 'error',
  DANGER: 'danger'
}
